import 'package:beamer/beamer.dart';
import 'package:flutter/material.dart';
import 'package:rabbit_mobile/i18n/strings.g.dart';

class HomeAppbar extends StatelessWidget implements PreferredSizeWidget {
  const HomeAppbar({super.key});

  @override
  Size get preferredSize => const Size.fromHeight(kTextTabBarHeight);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      height: MediaQuery.of(context).padding.top + kTextTabBarHeight,
      decoration: const BoxDecoration(
        image: DecorationImage(
          image: AssetImage("assets/home_appBar_bg.png"),
          fit: BoxFit.cover,
        ),
      ),
      child: SafeArea(
        child: Row(
          children: [
            Image.asset(
              'assets/home_scan.png',
              width: 30,
              height: 30,
            ),
            Expanded(
              flex: 1,
              child: Container(
                height: 25,
                margin: const EdgeInsets.symmetric(horizontal: 10),
                decoration: BoxDecoration(
                  color: const Color.fromRGBO(245, 245, 245, .4),
                  borderRadius: BorderRadius.circular(25),
                ),
                child: Row(
                  children: [
                    Image.asset(
                      'assets/home_search.png',
                      width: 35,
                      height: 35,
                    ),
                    const SizedBox(
                      width: 4,
                    ),
                    Text(
                      t.please_enter_the_search_content,
                      style: const TextStyle(fontSize: 14.0, color: Colors.white),
                    )
                  ],
                ),
              ),
            ),
            GestureDetector(
              onTap: () {
                Beamer.of(context).beamToNamed('/login');
              },
              child: Image.asset(
                'assets/home_login.png',
                width: 35,
                height: 35,
              ),
            )
          ],
        ),
      ),
    );
  }
}
